/*
* @Author: Administrator
* @Date:   2017-09-04 15:20:38
* @Last Modified by:   Administrator
* @Last Modified time: 2018-01-04 14:34:32
*/
const path = require('path');
const webpack = require('webpack'); 
const ROOT_PATH = path.resolve(__dirname); 
const ExtractTextPlugin=require('extract-text-webpack-plugin');
const HtmlWebpackPlugin=require('html-webpack-plugin');
const config={
  target:'node',
  entry:{
    server:'./src/server_entry.jsx',
  },
  output:{
    path    : path.join(__dirname, 'dist'),
    publicPath  : '/dist/',
    filename  : 'server/server_entry.js',
    libraryTarget:"commonjs2"
  },
  externals: Object.keys(require('./package.json').dependencies),
  resolve: {
    extensions: ['.js', '.jsx']
  },
  module:{
    rules:[
      {
          test: /\.css$/, loader: 'css-loader'
      },
      {test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/, loader: 'url-loader?limit=20&name=resource/[name].[ext]'},
      {
        test:/\.scss$/,loader:'css-loader!sass-loader'
      },
      {test:/\.jsx$/,loader:'babel-loader',exclude:'/node_modules/' },
      {test:/\.js$/,loader:'babel-loader',exclude:'/node_modules/' },
    ]
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.API_BASE': '"http://localhost:3000"',
      'process.env.RENDER_METHOD': '"server"'
    })
  ]
}
module.exports=config;
